<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>演出管理</title>
  <link rel="stylesheet" href="../../static/css/style.css">
  <script src="/static/script/jquery-1.7.2.js"></script>
  <script>
    $(function (){
      $("#return").click(function (){
        location = "/login";
      });
      //获取日期
      var date = document.getElementsByClassName("date")[0].value
      $("#add_schedule").click(function (){
        location = "/toUpdateOrAddSchedulePage?date="+date
      });

      $(".deleteSchedule").click(function (){
        //获取演出计划的id
        var scheduleId = $(this).attr("id")
        return confirm("确定要删除【"+scheduleId+"】演出计划吗？")
      });
    });
  </script>
</head>
<body>

<div id="login_page">
  <div class="logo" style="color: #39987c;">
    <img alt="" src="{{.User.ImgPath}}" style="width: 50px;height: 50px;border-radius: 50px;border: 2px solid darkblue;">{{.Username}}
    <form action="/scheduleManage" method="post"><input type="submit" value="确定" class="date_sub"><input class="date" type="date" name="date" value="{{.Date}}"></form></div>
  <div id="films">
    <div id="main">
      <table id="films_table">
        <thead>
        <tr id="first_th">
          <th>演出计划ID</th>
          <th>演出厅ID</th>
          <th>电影名称</th>
          <th>售价（元）</th>
          <th>日期</th>
          <th>开始时间</th>
          <th>结束时间</th>
          <th colspan="3">操作</th>
        </tr>
        </thead>

        {{range .Schedules}}
        <tr>
          <td style="text-align: center">{{.ID}}</td>
          <td style="text-align: center">{{.HallID}}</td>
          <td style="text-align: center">{{.FilmName}}</td>
          <td style="text-align: center">{{.Price}}</td>
          <td style="text-align: center">{{.Date}}</td>
          <td style="text-align: center">{{.StartTime}}</td>
          <td style="text-align: center">{{.EndTime}}</td>
          <td style="text-align: center"><a href="/toUpdateOrAddSchedulePage?scheduleID={{.ID}}&date={{.Date}}&filmName={{.FilmName}}" id="update_schedule">修改</a></td>
          <td style="text-align: center"><a href="/deleteSchedule?ID={{.ID}}" id="{{.ID}}" class="deleteSchedule">删除</a></td>
        </tr>
        {{else}}
        <tr>
          <td colspan="8">
            <div style="text-align: center">
            ┭┮﹏┭┮ ，空空如也，快去添加演出计划吧~
            </div>
          </td>
        </tr>
        {{end}}

      </table>
    </div>
    <input type="button" value="返回" id="return">
    <input type="button" value="添加演出计划" id="add_schedule">
  </div>
</div>
</body>
</html>